.well
  .row
    .col-md-4
      | 维修单号：#{@order_maintain.code}    
    .col-md-4
      | 客户姓名：#{@order_maintain.customer.name}
    .col-md-4
      | 客户级别：#{@order_maintain.customer.customer_level.name}
  .row
    .col-md-4
      | 手机号：#{@order_maintain.customer.phone}    
    .col-md-4
      | 车牌号：#{@order_maintain.customer.car_num}
    .col-md-4
      | 车型：#{@order_maintain.customer.car_mo} 
  .row
    .col-md-4
      | 备注：#{@order_maintain.note}
    .col-md-4
      | 创建日期：#{@order_maintain.created_at.strftime('%Y-%m-%d %H:%M:%S')}
    .col-md-4
      | 创建人：#{@order_maintain.user.name}
  - if @order_maintain.status != '新建'
    .row
      .col-md-4
        | 合计金额：#{@order_maintain.total}
        = link_to "预付款" , finance_maintain_payment_pay_path(:id=>@order_maintain.id), class: "btn btn-warning btn-xs", style: "margin-left:10px;", :remote=>true 
      .col-md-4
        | 付款状态：#{@order_maintain.payment_status}

form method = 'get'
  .panel.panel-default
    .panel-heading
      | 维修项目
      = link_to "选择项目" , new_order_maintain_item_path(:id=>@order_maintain.id), class: "btn btn-primary btn-xs", style: "margin-left:10px;", :remote=>true

    .panel-body
      .table-responsive
        table.table.table-bordered.table-hover
          tr
            th 项目名称
            th 工时
            th 价格
            th 操作
          
          -@order_maintain.order_maintain_items.each do |o|
            tr
              td = o.maintain_item.name
              td = o.maintain_item.working_hour
              td = o.maintain_item.amount
         
              td
                = link_to "删除" , order_maintain_item_path(:id => o.id), :method => "DELETE", data: {confirm: '一旦删除,将无法恢复,是否删除?'}, class: "btn btn-danger btn-xs"

  .panel.panel-default
    .panel-heading
      | 维修配件
      = link_to "选择配件" , new_order_maintain_part_path(:id=>@order_maintain.id), class: "btn btn-primary btn-xs", style: "margin-left:10px;", :remote=>true

    .panel-body
      .table-responsive
        table.table.table-bordered.table-hover
          tr
            th 配件编号
            th 配件名称
            th 数量
            th 单位
            th 销售单价
            th 小计
            th 操作
          
          -@order_maintain.order_maintain_parts.each do |o|
            tr
              td = o.part.code
              td = o.part.name
              td = o.qty
              td = o.part.unit
              td = o.part.sales_price
              td = o.sub_total
         
              td
                = link_to "删除" , order_maintain_part_path(:id => o.id), :method => "DELETE", data: {confirm: '一旦删除,将无法恢复,是否删除?'}, class: "btn btn-danger btn-xs"
 
  - if @order_maintain.status == '新建'
    button type='submit' class="btn btn-success btn-lg btn-block" name='save' data={confirm: '确定完成？'} 完成接车 
  - elsif @order_maintain.status == '已服务'
    button type='submit' class="btn btn-warning btn-lg btn-block" name='check' data={confirm: '确定完成？'} 完成质检

                
